program Project2;

{$APPTYPE CONSOLE}

uses
  SysUtils;

var
  i, n0, n, x0, y0 : integer;
  x, y, p : real;
  fouta, foutb : textfile;

begin
  assignfile(fouta, 'outputa.txt');
  rewrite(fouta);
  assignfile(foutb, 'outputb.txt');
  rewrite(foutb);

  x0:=1;
  y0:=1;
  randomize;
  n:=0;
  n0:=0;
  for i:= 0 to 1000000000-1 do
  begin
    x:=2*random;
    y:=2*random;
    if ((x-1)*(x-1)+(y-1)*(y-1)<=1) then
      n0:=n0+1;
    n:=n+1;
    p:=pi-abs((4*n0)/n);
    if (n mod 100000 = 0) then
    begin
      writeln(fouta, p:0:9);
      writeln(foutb, n);
    end;
  end;

  writeln('End!');
  closefile(fouta);
  closefile(foutb);
  readln;
end.
